{{- range $ng := .Values.nodeManager.internal.nodeGroups }}
  {{- if or (eq $ng.nodeType "CloudEphemeral") (eq $ng.nodeType "Cloud") }}
    {{- if hasKey $.Values.nodeManager.internal "cloudProvider" }}
      {{- if $.Values.nodeManager.internal.cloudProvider.capiClusterKind }}
        {{- range $zone_name := $ng.cloudInstances.zones }}
          {{ $instance_class_checksum := include "capi_node_group_instance_class_checksum" (list $ $ng) }}
          {{ $instance_class_hash := printf "%v%v%v" $.Values.global.discovery.clusterUUID $zone_name $instance_class_checksum | sha256sum | trunc 8 }}
          {{ $template_name := printf "%s-%s" $ng.name $instance_class_hash }}
          {{ $bootstrap_secret_name := $template_name}}
          {{- include "capi_node_group_machine_bootstrap_secret" (list $ $ng $zone_name $bootstrap_secret_name) }}
          {{- include "capi_node_group_machine_template" (list $ $ng $zone_name $template_name $instance_class_checksum) }}
          {{- include "capi_node_group_machine_deployment" (list $ $ng $zone_name $template_name $bootstrap_secret_name $instance_class_checksum) }}
        {{- end }}
      {{- else }}
        {{- range $zone_name := $ng.cloudInstances.zones }}
          {{- include "node_group_machine_class" (list $ $ng $zone_name) }}
          {{- include "node_group_machine_class_secret" (list $ $ng $zone_name) }}
          {{- include "node_group_machine_deployment" (list $ $ng $zone_name) }}
        {{- end }}
      {{- end }}
    {{- end }}
  {{- else }}
    {{- include "node_group_static_or_hybrid_secret" (list $ $ng) }}
    {{- if hasKey $ng "staticInstances" }}
      {{- include "node_group_static_or_hybrid_machine_template" (list $ $ng) }}
      {{- include "node_group_static_or_hybrid_machine_deployment" (list $ $ng) }}
    {{- end }}
  {{- end }}
{{- end }}
